package org.thread.test05.demo03;

/**
 * @author ZJL
 * @date 2025-03-12
 */
public class MyThread extends Thread {
    private Account account;
    private double money;
    private String user;
    public MyThread(){

    }
    public MyThread(Account account, String user, double money) {
        this.account = account;
        this.user = user;
        this.money = money;
    }

    @Override
    public void run() {
        account.getMoney(user,money);
//        synchronized (lock) {
//            if(account.getMoney() >= m) {
//                account.setMoney(account.getMoney() - m);
//                System.out.println(Thread.currentThread().getName()+":取出"+m+"元,剩余："+account.getMoney());
//            }else{
//                System.out.println(Thread.currentThread().getName()+":"+m+"取出失败！"+"剩余"+account.getMoney()+",余额不足");
//            }
//
//        }
    }
}
